﻿
namespace Bettzueche.Dampfross
{
    public static class MyExtensions
    {

        /// <summary>
        /// Determines whether the specified river flags has river at direction <c>dir</c>.
        /// </summary>
        /// <param name="riverFlags">The river flags.</param>
        /// <param name="dir">The direrction.</param>
        /// <returns><c>true</c>, if the riverFlag vor specified direction is set; false, otherwise</returns>
        public static bool HasRiverAt(this Rivers riverFlags, HexRichtungen dir) {
            switch (dir) {
                case HexRichtungen.NO:
                    return (riverFlags & Rivers.NordOst) == Rivers.NordOst;
                case HexRichtungen.N:
                    return (riverFlags & Rivers.Nord) == Rivers.Nord;
                case HexRichtungen.NW:
                    return (riverFlags & Rivers.NordWest) == Rivers.NordWest;
                case HexRichtungen.SW:
                    return (riverFlags & Rivers.SudWest) == Rivers.SudWest;
                case HexRichtungen.S:
                    return (riverFlags & Rivers.Sud) == Rivers.Sud;
                case HexRichtungen.SO:
                    return (riverFlags & Rivers.SudOst) == Rivers.SudOst;
                default:
                    return false;
            }
        }

    }
}
